<template>
    <el-tag :type="type" effect="dark"   style="padding: 5px;">{{ label }}</el-tag>
</template>

<script lang="ts">
export default defineComponent({
  name: 'TagRender',
  
})
</script>
<script setup  lang="ts">
import { useI18n } from 'vue-i18n'
const {t} = useI18n()
/**
 * @description: 标签映射
 * @param {any} name 标签名称
 * @param {any} value 标签值
 * @return {any} 标签
 * @orbit 轨道
 * @bool 使用状态
 * @networkStatus 入网状态
 * @antennaStatus 天线状态
 * @workMode 工作模式
 * @antennaSwitch 天线开关
 * @basicSettingsSwitch 基础设置开关
 * @dnnSwitch DNN开关
 */
const tagMap:any = computed(() => ({
      orbit: {
        highrail: { label: t('functionService.high_orbit_label'), type: 'primary' },
        lowrail: { label: t('functionService.low_orbit_label'), type: 'primary' },
        default: { label: t('functionService.default_orbit_label'), type: 'warning' },
      },
      bool: {
        true: { label: t('functionService.in_use_label'), type: 'primary' },
        false: { label: t('functionService.not_in_use_label'), type: 'danger' },
        default: { label: t('functionService.default_bool_label'), type: 'warning' },
      },
      antennaStatus: {
        normal: { label: t('antennaManage.normal_status'), type: 'primary' },
        abnormal: { label: t('antennaManage.abnormal_status'), type: 'danger' },
        default: { label: t('antennaManage.normal_status'), type: 'primary' },
      },
      workMode:{
        standby: { label: t('antennaManage.standby_mode'), type: 'primary' },
        collect: { label: t('antennaManage.collect_mode'), type: 'primary' },
        track: { label: t('antennaManage.track_mode'), type: 'primary' },
        default:{ label: t('antennaManage.standby_mode'), type: 'primary' },
      },
      antennaSwitch:{
        on: { label: t('antennaManage.enable_true'), type: 'primary' },
        off: { label: t('antennaManage.enable_false'), type: 'danger' },
        default:{ label: t('antennaManage.enable_true'), type: 'primary' },
      },
      basicSettingsSwitch:{
        on: { label: t('networkConfig.on_label'), type: 'primary' },
        off: { label: t('networkConfig.off_label'), type: 'danger' },
        default:{ label: t('networkConfig.on_label'), type: 'primary' },
      },
      dnnSwitch:{
        on: { label: t('networkConfig.on_label'), type: 'primary' },
        off: { label: t('networkConfig.off_label'), type: 'danger' },
        default:{ label: t('networkConfig.on_label'), type: 'primary' },
      },
      networkStatus:{
        success: { label: t('functionService.connected_label'), type: 'primary' },
        failed: { label: t('functionService.not_connected_label'), type: 'danger' },
        default:{ label: t('functionService.success_label'), type: 'primary' },
      },
      connect:{
        on: { label: t('networkConfig.connected_label'), type: 'primary' },
        off: { label: t('networkConfig.not_connected_label'), type: 'danger' },
        default:{ label: t('networkConfig.connected_label'), type: 'primary' },
      }
}))
const {value,name} = defineProps(['value','name'])
const label = computed(()=>{
    return tagMap.value[name][value]?.label || tagMap.value[name].default?.label
})
const type = computed(()=>{
  return tagMap.value[name][value]?.type || tagMap.value[name].default?.type
})

</script>

<style  lang="scss" scoped></style>
